<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>礼拜五-手机登录</title>
    <link rel="stylesheet" href="./stylesheets/reset.css">
    <link href="http:////at.alicdn.com/t/font_1512981_qy3wz899e7.css" rel="stylesheet">
    <link rel="stylesheet" href="./stylesheets/lyjcss/login.css">
    <style>
        form{
            height: 500px;
        }
    </style>
</head>

<body>
    <form>
        <div class="Lstyle">
            <p>登录</p>
            <a href="/psdLogin">账号密码登录
                <i class="iconfont icon-denglu"></i>
            </a>
        </div>
        <div class="tel">
            <input type="tel" class="aValue" name="tel" placeholder="请输入手机号" value="1211">
            <i class="iconfont icon-xuanzhong"></i>
        </div>
        <div class="code">
            <input type="text" placeholder="验证码">
            <div id="v_container" style="width: 79px;height: 34px;"></div>
            <span>看不清换一张</span>
        </div>
        <div class="telCode">
            <input type="text" placeholder="手机验证码">
            <div class="getCode">获取验证码</div>
        </div>
        <div class="check">
            <div>
                <input type="checkbox">
                <span>自动登录</span>
            </div>
            <a href="/forget">忘记密码?</a>
        </div>

        <div class="sub">
            <!-- <button type="submit">登录</button> -->
            <input type="button" value="登录" id="btnSub">
            <a href="/register">会员注册</a>
        </div>
        <span class="remind">提示：未注册用户将直接注册为礼拜五用户</span>
        <p class="loginS">---------------<span>用合作网站登录</span>---------------</p>
        <div class="parter">
            <div class="weChat">
                <i class="iconfont icon-weixin1"></i>
            </div>
            <div class="QQ">
                <i class="iconfont icon-QQ"></i>
            </div>
        </div>
    </form>
</body>
<script src="./javascripts/lyjjs/code.js"></script>
<script>
    var allData ={};
    $("#btnSub").click(function () {
        $('.aValue').each(function (i) {
            allData[$(this).prop('name')] = $(this).val();
        })
        $.ajax({
            url: '/allLogin/telInfo',
            type: 'post',
            dataType: 'json',
            data: allData,
            success: function (data) {
                if (data.code == 200){
                    localStorage.setItem('userID',data.userID[0].id);
                    location.href = '/';
                }
                else if (data.code == 'no exist'){
                    console.log('登录用户不存在！')
                }else if (data.code == 'regsuccess'){
                    location.href = '/psdLogin'
                }else if(data.code == 'exist'){
                    console.log('注册用户已存在')
                }else if(data.code == 'psderr'){
                    console.log('用户和密码错误！')
                }else{
                    console.log('重置密码成功！')
                    location.href = '/psdLogin'
                }
            }
        })
    })
</script>

</html>